from django.shortcuts import render
from django.http.response import HttpResponse
from datetime import datetime

def index(request):
    data = '<h1>goods-index</h1>'
    return HttpResponse(data,content_type="text/html")

def info(request):
    data = [
        {
            "id": "001",
            "name": "cup",
            "price": 50.00,
            "time": datetime.now()
        },
        {
            "id": "002",
            "name": "book",
            "price": 25.125,
            "time": datetime.now()
        },
        {
            "id": "003",
            "name": "pen",
            "price": 10.5,
            "time": datetime.now()
        },
        {
            "id": "004",
            "name": "bag",
            "price": 150.1989,
            "time": datetime.now()
        }
    ]
    return render(request,'info.html',{"data":data})

def type(request):
    name = 'cup'
    type = 1
    return render(request,'type.html',{"good_type":type,"name":name})

def special(request):
    # name = "special goods"
    website = "<a href = '#'>点击购买</a>"
    return render(request,'special.html',{"web":website})
